<div>1</div>
<div>2</div>
<div>3</div>
<script>
    /**
     * jQuery源码仿写
    */
    ;(function(window,underfined){
        function init(el){
            let els=document.querySelectorAll(el)
            // for(i=0;i<els.length;i++){
            //     this[i]=els[i]
            // this.length=els.length
            let arr=[]
            arr.push.apply(this,els)

            }
            let jQuary=function(el){
                return new init(el)
            }
            //插件
            jQuary.extend=function(object){
                for(let key in object){
                    init.prototype[key]=object[key]

                }
            }
           //原型方法
            init.prototype={//this指实例化对象 
                css(cssAttr,cssVal){
                    for(let i=0;i<this.length;i++){
                        this[i].style[cssAttr]=cssVal
                        //另一种方式
                        

                    }
                    return this
                },
                ajax(options){},
                addClass(options){},
                attr(options){}
            }
            window.jQuary=window.$=jQuary

        }
        

    )
    (window)
 
  
</script>